<template>
	<view class="main">
		<u-navbar back-text="" leftText="订阅好活列表" titleStyle ="font-size:36rpx" slot="left" :autoBack="true" safeAreaInsetTop placeholder>
			<view slot="right" class="leftText dis-row">
				<view class="search" @click="navNewsInfo()">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/dingyue-ico.png"></image>订阅好活 						 
				</view>
			</view>
		</u-navbar>
		
		<!-- <view class="card-head dis-row">
			<view class="let-ico head-hei" @click="navBack"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/left-jiantou.svg"></image></view>
			<view class="cen-title head-hei">订阅好活列表</view>
			<view class="rig-share head-hei dis-row">
				<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/dingyue-ico.png"></image></label>
				<text>订阅好活</text>
			</view>
		</view> -->
		<!-- <view class="v-tops">
			<u-navbar  :autoBack="true" :safeAreaInsetTop="true">
				<view slot="left" class="cen-title head-hei dis-row">
					<u-icon name="arrow-left" size="22" color="#000000" style="margin-left: 10rpx;"></u-icon>
				订阅好活列表</view>
				<view slot="right" @click="navNewsInfo()" class="rig-share dis-row" style="padding-right: 130rpx;font-weight: normal;">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/dingyue-ico.png"></image></label>
					<text>订阅好活</text>
				</view>
			</u-navbar>
		</view> -->
		
		<!--list type1 star    t-->
		<block v-if="listrow.length>0">
		<view class="inter-item" >
			<view class="item-block v-box dis-clm" v-for="(item,index) in listrow" :key="index">
				<view class="block-title dis-row poser" @click="NavInfoMsg(item)">
					<label v-if="item.type == 1">置顶</label>
					<text  v-if="item.type == 0">{{item.address}}、{{item.skills}}</text>
					<view  v-if="item.type == 1">{{item.address}}、{{item.skills}}</view>
					<!-- <text v-if="item.type == 0">{{cutstr(item.title,65)}}</text>
					<view v-if="item.type == 1">{{cutstr(item.title,65)}}</view> -->
				 </view>
				<view class="block-pre" @click="NavInfoMsg(item)"  v-if="item.workDesc">{{cutstr(item.workDesc,103)}}</view>
				<view class="bloc-small" @click="NavInfoMsg(item)">
					<label class="noactive" v-if="item.salaryStr">{{item.salaryStr}}</label>
					<label v-if="item.settlementStr">{{item.settlementStr}}</label>
					<block v-if="item.welfareNew"><label v-for="(childitem,childindex) in item.welfareNew">{{childitem}}</label></block>
				</view>
				<view class="bloc-filename poser">
					<!--个人认证的开始-->
					<view class="file-left dis-clm"  v-if="item.isEnterprice!=1 && item.isRealName ==1" @click="NavInfoMsg(item)">
						<!-- <view class="left-t1 dis-row">
							<view class="leftchild-v1" v-if="item.nickName">{{item.nickName}}</view>
							<block v-if="item.isEnterPrise == 0 && item.isRealName == 1">
							  <image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg" />
							  <text>实名认证</text>
							</block>
						</view> -->
						<view class="button-v1 dis-row">
							<view class="map-ico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/ico-address.svg"></image></view>
							<view class="bt-s dis-row">
								<label>{{item.cityArea}}</label><text>·</text><label>{{item.createTime}}</label>
							</view>
						</view>
					</view>
					<!--个人认证的结束-->
					<!--企业认证的开始-->
					<view class="file-left dis-clm" v-if="item.nickName!='' && item.isRealName ==0" @click="NavInfoMsg(item)">
						<!-- <view class="left-t1 dis-row">
							<view class="leftchild-v1" v-if="item.nickName">{{item.nickName}}</view>
							<block v-if="item.isEnterPrise == 0 && item.isRealName == 1">
							  <image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg" />
							  <text>实名认证</text>
							</block>
						</view> -->
						<view class="button-v1 dis-row">
							<view class="map-ico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/ico-address.svg"></image></view>
							<view class="bt-s dis-row">
								<label>{{item.cityArea}}</label><text>·</text><label>{{item.createTime}}</label>
							</view>
						</view>
					</view>
					<!--企业认证的结束-->
					<view class="rev-av dis-clm">
						<view class="botton-sv1">
							<!-- <label class="labelbg1">接通率高</label> -->
							<!-- <label class="labelbg2">接通率高</label> -->
						</view>
						<view class="botton-sv2" @click="NavInfoMsg(item)">立即联系</view>
					</view>
				</view>
			</view>
		</view>
		<!--list type1 over-->	
	</block>
	<block v-if="listrow.length == 0">
		<view class="empty-img" style="padding-top: 530rpx;">
			<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
			<label>暂无内容</label>
		</view>
	</block>
		
	</view>
</template>

<script>
import Index from "@/common/index-model.js"
let index = new Index();
let that = null;
export default {
	data() {
		return {
			listrow:[]
		}
	},
	onLoad() {
	  this.getList()	
	},
	methods: {
		navBack() {
			index.navigate_back(1)
		},
		getList() {
			let send = {
				"time":this.timestampToTime()
			}
			this.listrow =[]
			index.getPublicUserMember(send,'client/individual/find/subscribe','post',res=>{
				let arr = [],welfares=[]
				if(res.data.code == 200 && res.data.success){
					//this.listrow = res.data.result
					 arr= res.data.result
					if(arr.length>0){
					  for(let i=0;i<arr.length;i++){
					  //	arr[i].titleName = arr[i].address+'招'+arr[i].skills  //拼接地址+技能 = 列表标题
						if(arr[i].welfare){
							welfares=arr[i].welfare.split(',');
							for(let i=0;i<welfares.length;i++){
								if(welfares[i] == ''){
									welfares.splice(i,1)
								}
							}
							arr[i].welfareNew = welfares;
							//arr[i].welfareNew = arr[i].welfare.split(',')
						}else{
							arr[i].welfareNew = []
						}
						this.listrow.push(arr[i])
					  }
					}
				}else{
					this.listrow = []
				}
			})
		},
		timestampToTime() {
			var date = new Date();//时间戳为10位需*1000，时间戳为13位的话不需乘1000
			var Y = date.getFullYear()+'-';
			var M = (date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1)+'-';
			var D = date.getDate()<10?('0'+date.getDate()+' '):(date.getDate()+' ');
			var h = date.getHours()<10?('0'+date.getHours()+':'):(date.getHours()+':');
			var m = date.getMinutes()<10?('0'+date.getMinutes()+':'):(date.getMinutes()+':');
			var s = date.getSeconds()<10?('0'+date.getSeconds()):(date.getSeconds());
			// var m = date.getMinutes() + ':';
			// var s = date.getSeconds();
			return Y+M+D+h+m+s;
		},
		cutstr(str, len) {
			var str_length = 0;
			var str_len = 0;
			var str_cut = new String();
			str_len = str.length;
			for (var i = 0; i < str_len; i++) {
				var a = str.charAt(i);
				str_length++;
				if (escape(a).length > 4) {
					//中文字符的长度经编码之后大于4  
					str_length++;
				}
				str_cut = str_cut.concat(a);
				if (str_length >= len) {
					str_cut = str_cut.concat("...");
					return str_cut;
				}
			}
			//如果给定字符串小于指定长度，则返回源字符串；  
			if (str_length < len) {
				return str;
			}
		},
		//跳转到订阅
		navNewsInfo() {
			index.navigate_to('/pagesC/my/myDingyue')
		},
		NavInfoMsg(item) {
			if(!uni.getStorageSync('token')){
				index.navigate_to('../../pagesC/login/login')
				return false
			}
			let url = '../../pagesB/jobinfo/index?id=' + item.orderId
			index.navigate_to(url)
		},
	}
}	
</script>

<style lang="scss">
@import url("@/static/css/publics.css");
@import url("@/static/css/subscribeList.css");	
::v-deep {
  .u-navbar--fixed {	  
	  background-size: 100%;
	  // background-image: url('http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/bg1.png');
	  // background-repeat: no-repeat;
	  background: #ffffff;
    // background-image: linear-gradient(to bottom, #42cdff, #0288ff);
    & > view {
      background: transparent !important;
    }
    .leftText {
      color: #fff;font-size: 36rpx;font-weight:bold;
    }
	.search{ border: 1px solid #E4F0FF; margin-right: 180rpx; display: flex; justify-content: center; color: #3D3D3D; font-size: 24rpx; border-radius: 48rpx; width: 160rpx; height: 48rpx; line-height: 48rpx; text-align: center;}
	.search image{width: 30rpx; height: 30rpx; margin-right: 10rpx; margin-top: 8rpx;}
  }
}	
</style>